package cn.my;

import cn.hutool.json.JSONUtil;

public class Result {

    private boolean success;

    private String msg;

    private String url;

    private String sha;

    private String path;

    public Result() {

    }

    public Result(boolean success, String msg,String url,  String sha, String path) {
        this.success = success;
        this.msg = msg;
        this.url = url;
        this.sha = sha;
        this.path = path;
    }

    public boolean isSuccess() {
        return success;
    }

    public Result setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    public String getUrl() {
        return url;
    }

    public Result setUrl(String url) {
        this.url = url;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public Result setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public String getSha() {
        return sha;
    }

    public Result setSha(String sha) {
        this.sha = sha;
        return this;
    }

    public String getPath() {
        return path;
    }

    public Result setPath(String path) {
        this.path = path;
        return this;
    }

    public static Result succ(String url, String sha, String path) {
        return new Result(true, "上传成功",url,sha,path);
    }

    public static Result delSucc() {
        return new Result(true,"删除成功",null,null,null);
    }

    public static Result err(String msg) {
        return new Result(false,msg,null,null,null);
    }


    @Override
    public String toString() {
        return JSONUtil.toJsonStr(this);
    }
}
